
package cakeorcookiexample.works;

import controlisolation.lifecyclefsm.stateexecutor.StateWork;
import java.util.logging.Level;


public class CheckDessertWork extends StateWork{

    @Override
    public void doWork()  {
        _logger.log(Level.INFO,"[CheckDessertWork]");
        addInfoMessage(100, "CLASS:"+this.getClass().getName());
        
        String previously_produced=(String)this.getWorkInputs().get("PRODUCED");
        
        if (!(
                ("COOKIE".equals(previously_produced))||
                ("CAKE".equals(previously_produced)) ) )
        {
            _logger.log(Level.SEVERE,"Strange Dessert Prepared!");
        } else
        {
           
          
            addInfoMessage(100,"-------------->"+previously_produced+"<------------");
            
            _logger.log(Level.INFO,previously_produced+" was prepared.");
        }
                
                
        
        
        pauseFor(100);
        
        // Consume the dessert
        getWorkOutputs().put("PRODUCED","");
        
        
    }

}
